package com.hurried1y.handler;

import com.hurried1y.exception.SystemException;
import com.hurried1y.utils.R;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * User：Hurried1y
 * Date：2023/4/3
 */
@RestControllerAdvice
public class GlobalExceptionHandler {
    @ExceptionHandler(SystemException.class)
    public R systemExceptionHandler(SystemException e){
        return R.error(e.getCode(), e.getMsg());
    }
}
